﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PhysicsControlModule.Models;

namespace PhysicsControlModule.Daos
{
    public class AdmAnswerDao
    {
        public static List<AdmAnswer> Load(int labworkId, int admQuestionId)
        {
            using (CmDbEntities db = new CmDbEntities())
            {
                return (
                    from aa in db.AdmAnswer 
                    from raqa in db.RelAdmQuestionAnswer
                    from rlaq in db.RelLabworkAdmQuestion
                    where raqa.QuestionId == admQuestionId
                    where raqa.AnswerId == aa.Id
                    where rlaq.LabworkId == labworkId
                    where rlaq.QuestionId == raqa.QuestionId
                    select aa).ToList();
            }
        }
    }
}